<?php
// +----------------------------------------------------------------------
// | MYUPHP [ Simple and practical framework ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020-08-10 http://myuphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 梦雨 <50361804@qq.com>
// +----------------------------------------------------------------------
use myuphp\common\Myuphp;
header('Content-Type:text/html;charset=utf-8');  
defined('PATH') or define('PATH', 'app');
defined('MYUPHP') or define('MYUPHP', 'myuphp');
require_once MYUPHP . '/Common/Myuphp.php';
require_once MYUPHP . '/Common/Session.php';
if (Myuphp::os_config('debug') == 'false') {
	error_reporting(0);
} else {
	error_reporting(E_ERROR | E_WARNING | E_PARSE);
}
$arr = explode(Myuphp::os_config('path'), Myuphp::server());
if (Myuphp::os_config('path')=='/') {
	$arr = explode(Myuphp::os_config('path'), Myuphp::server());
} else {
	$arr = explode(Myuphp::os_config('path'), preg_replace("/\//is", Myuphp::os_config('path'), Myuphp::server()));
}
if (empty($arr[1])) {
    defined('GET') or define('GET','/'. Myuphp::get_url('s', 'index'));
    defined('APP_AR') or define('APP_AR', Myuphp::get_url('c', 'index'));
    defined('APP_MY') or define('APP_MY', Myuphp::get_url('m', 'index'));
    defined('APP_NEW') or define('APP_NEW', '\\'.Myuphp::get_url('s', 'index'));
} else {
    defined('GET') or define('GET', '/' . Myuphp::get_url('s', $arr[1]));
    defined('APP_AR') or define('APP_AR', Myuphp::get_url('c', $arr[3]));
    defined('APP_MY') or define('APP_MY', Myuphp::get_url('m', $arr[2]));
    defined('APP_NEW') or define('APP_NEW', '\\' . Myuphp::get_url('s', $arr[1]));
}
defined('APP_MA') or define('APP_MA', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+');
defined('APP_P') or define('APP_P', '/data/public');
defined('APP_CONFIG') or define('APP_CONFIG', 'data/config');
defined('APP_NAME') or define('APP_NAME', 'MyuPHP框架');
defined('APP_BB') or define('APP_BB', '1.0');
require_once 'myuphp/Common/Tpl.php';
require_once  Myuphp::file(PATH . GET . '/' . APP_MY . '.php');
require_once MYUPHP . '/Common/Db.php';
require_once MYUPHP . '/Common/Common.php';
$className = Myuphp::get_app(PATH) . APP_NEW . '\\' . APP_MY;
$take = new $className();
$obtain = Myuphp::get('c', APP_AR);
if(!method_exists($take,$obtain)){
    Myuphp::Jump('未定义方法');
} else {
    $data = $take->{$obtain}();
}